<include file="Public/min-header"/>
<div class="wrapper">
  <section class="content">
    <div class="container-fluid">
      <div class="panel panel-default">
        <div class="panel-body">
          <div id="ajax_return"> 
			    <div class="table-responsive">
			        <table class="table table-bordered table-hover">
			            <thead>
			                <td class="text-left"><input type="checkbox" onclick="$('input[name*=\'coupon_id\']').prop('checked', this.checked);">全选</td>
			                <td class="text-left">优惠券名称</td>           
			                <td class="text-left">操作</td>
			            </tr>
			            </thead>
			            <tbody id="coupon_table">
			                <volist name="conponList" id="list">
                               <tr>
                               	<td class="text-left">                
                                        <input type="checkbox" name="coupon_id[]" value="{$list.id}"/>
                                   </td>
                                   <td class="text-left">{$list.name}</td>
                                   <td><a href="javascript:void(0)" onclick="javascript:$(this).parent().parent().remove();">删除</a></td>
                               </tr>                              
			            	</volist>   
			            </tbody>
			        </table>
			    </div>
			    <div class="row">
	              	<div class="text-left col-sm-10">
	            		{$page}
	            	</div>
	                <div class="text-right col-sm-2">
	                    <a href="javascript:void(0)" style="margin:20px 0;" onclick="select_goods();" class="btn btn-info">确定</a>			                       
					</div>
			    </div>
          </div>
        </div>
      </div>
    </div>
  </section>
  <script>
  function select_goods()
  {	  
	   if($("input[type='checkbox']:checked").length == 0)
	   {
		   layer.alert('请选择优惠券', {icon: 2}); //alert('请选择商品');
		   return false;
	   }
	  	//将没选中的复选框所在的  tr  remove  然后删除复选框
	    $("input[type='checkbox']").each(function(){
		   if($(this).is(':checked') == false)
		   {
			    $(this).parent().parent().remove();
			    //$("#goods_list", window.parent.document).append("<tr>"+$(this).html()+'<td><a href="javascript:;" class="icon-close" onclick="goods_del(this)"></a></td></tr>');
		   }else{
			   $(this).parent().css('display','none');
			   $(this).attr("checked","checked");
		   }
		   //$(this).siblings().show();
	    });
		$(".btn-info").remove();	
        javascript:window.parent.call_back_coupon($('#coupon_table').html());
  }    
  </script>
</div>
</body>
</html>